source("perceptron.R")

maxit = 15
learn.rate = 0.1
animation = T
stepbystep = T

x <- t(matrix(c(
				0,0,
				0,1,
				1,0,
				1,1),
		2,4))

# OR #
y <- matrix(c(
				0,
				1,
				1,
				1), 
		4, 1)

colnames(x) <- c("x", "y")

# training 
model <- perceptron(x, y, maxit = maxit, learn.rate = learn.rate,
					stepbystep = stepbystep,
					animation = animation, ani.step = 1, ani.delay = 1)

# report result
plot(1:maxit, model$errors, type='l', xlab="iter", ylab="error")

